package appapi.service.impl;

import appapi.Global.BusinessException;
import appapi.Request.ApiReq.EquipApiReq;
import appapi.dao.EquipInfoMapper;
import appapi.dto.EquipInfoDto;
import appapi.entity.Zhongjiao.EquipInfoEntity;
import appapi.service.IEquipInfoService;
import appapi.utils.DateUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author djq
 * @date 2023/8/5 10:20
 * @description:
 */

@Service
public class EquipInfoService implements IEquipInfoService {

    @Resource
    private EquipInfoMapper equipInfoMapper;


    public int deleteByPrimaryKey(String equipId) {
        return equipInfoMapper.deleteByPrimaryKey(equipId);
    }


    public int insert(EquipInfoEntity record) {
        return equipInfoMapper.insert(record);
    }


    public int insertSelective(List<EquipInfoDto> record) {

        return 0;
    }

    @Override
    public PageInfo<EquipInfoEntity> selectPage(EquipApiReq req) {
        PageHelper.startPage(req.getCurrentPage(), req.getPageSize());
        List<EquipInfoEntity> equipInfoEntities = equipInfoMapper.selectAll(req);

        return new PageInfo(equipInfoEntities, req.getPageSize());
    }


    public EquipInfoEntity selectByPrimaryKey(String equipId) {
        return equipInfoMapper.selectByPrimaryKey(equipId);
    }


    public int updateByPrimaryKeySelective(EquipInfoEntity record) {
        return equipInfoMapper.updateByPrimaryKeySelective(record);
    }


    public int updateByPrimaryKey(EquipInfoEntity record) {
        return equipInfoMapper.updateByPrimaryKey(record);
    }

}
